﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Web;

namespace WebApplication1
{
    public class DbHelper
    {
        private static readonly string conString = "server=.;database=CMS;uid=sa;pwd=123456;";

        public static DataTable GetDataTable(string sql)
        {
            SqlDataAdapter adapter = new SqlDataAdapter(sql, conString);

            DataTable dataTable = new DataTable();

            DbHelper.GetDataTable(sql);

            return dataTable;
        }

        public static int AddOrUpadteOrDel(string sql)
        {
            SqlConnection connection = new SqlConnection(conString);
            SqlCommand sqlCommand = new SqlCommand(sql,connection);
            connection.Open();
            var count=sqlCommand.ExecuteNonQuery();
            connection.Close();
            return count;
        }
    }
}